package com.bicon.botu.finance.wallet.rpc;

import com.bicon.botu.finance.wallet.common.FinanceConstants;
import com.bicon.botu.finance.wallet.common.WalletConstants;
import com.bicon.botu.finance.wallet.service.WalletService;
import com.bicon.botu.core.base.common.controller.BaseController;
import com.bicon.botu.core.base.common.entity.BaseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 钱包rpc
 * @author tandk
 * @date 2017/9/15 0015 上午 9:49
 */
@RestController
@RequestMapping("/V1.0.0/rpc/wallet")
public class WalletRpc extends BaseController{


    @Autowired
    private WalletService walletService;

    /**
     * 通过userid给钱包加钱
     * @param userId
     * @param money
     * @return
     */
    @RequestMapping(value = "/addIncome",method = RequestMethod.POST)
    public BaseResult addIncome(@RequestParam(value = "userId") String userId, @RequestParam(value = "money") double money,
                                @RequestParam(value = "appId") String appId,@RequestParam(value = "module") String module,
                                @RequestParam(value = "business") String business){
        return walletService.addBalance( appId,  module,  business,userId,money, FinanceConstants.WALLET_SUBJECTS_INCOME);
    }

    /**
     * 支付结果通知
     */
//    @RequestMapping(value = "/notify",method = RequestMethod.POST)
//    public BaseResult notify(@RequestParam(value = "userId") String userId, @RequestParam(value = "orderNo") String orderNo, @RequestParam(value = "money") String money){
//
//
//        return walletService.payConfirm();
//    }
}
